<?php

include("./PDO/PdoAdmin.php"); //On inclut les fonctions PDO (create / update etc...)
include("./class/Admin.php"); //On inclut les fonctions PDO (create / update etc...)

foreach ($lesNews as $unenews) {

    $IdAdmin = $unenews["IDADMIN"];
    $admin = new PdoAdmin();
    $admin = $admin->readOne($IdAdmin);

    echo'<div id = "news">';
    echo'<h1>';
    echo $unenews["TYPENEWS"];
    echo '<a href="index.php?route=accueil&action=readOne&IdNews=' . $unenews["IDNEWS"] . '">';
    echo $unenews["TITRENEWS"];
    echo '</a>';
    echo'</h1>';
    echo '<div class="infos_news">';
    echo'<p>';
    echo'<img src="images/avatar.png"/><br/>';
    echo '@';
    echo '<font>' . $admin->getPseudoAdmin() . '</font>';
    echo ' ';
    echo 'écrit le';
    echo $unenews["DATENEWS"];
    echo'</p>';
    echo'</div>';
    echo'<div class="contenu_news">';
    echo'<p>';
    echo $unenews["CONTENUNEWS"];
    echo'</p>';
    echo'<div class="comments">';
    if (empty($_SESSION['PSEUDOUTILISAT'])) { // non connecté
        echo'(0) commentaires - Commenter';
    } else {
        echo'<a href="index.php?route=commentaire&action=lister">(0) commentaires</a>';
        echo '<a href="index.php?route=commentaire&action=ajouter">commenter</a>';
    }
    echo'</div>';
    echo'</div>';
    echo'</div>';
}
?>
